/**
 * 防抖函数
 * @param {function} func callback: () => {} 
 * @param {number} delay 需要延迟的毫秒数
 * @returns function
 */
export function debounce(func, delay) {
  let timeout;
  return function () {
    clearTimeout(timeout);
    let context = this, args = arguments;
    timeout = setTimeout(function () {
      func.apply(context, args);
    }, delay)
  };
};
